﻿using System;
using System.Windows;
using System.Windows.Markup;

namespace Luna.Globalization
{
    [MarkupExtensionReturnType(typeof(object)), Localizability(LocalizationCategory.NeverLocalize)]
    public class ResourceExtension : MarkupExtension
    {

        public ResourceExtension()
        { }

        public ResourceExtension(object key)
        {
            Key = key;
        }

        [ConstructorArgument("Key")]
        public object Key
        { get; set; }

        public override object ProvideValue(IServiceProvider serviceProvider)
        {
            return LanguageReader.GetValue(Key);
        }
    }
}
